.class public Lcom/netease/netstat/statistics/LocalIpTest;
.super Lcom/netease/netstat/statistics/BaseTest;
.source "LocalIpTest.java"


# direct methods
.method public constructor <init>(Landroid/telephony/TelephonyManager;Landroid/net/ConnectivityManager;Lcom/netease/netstat/utils/FileService;)V
    .locals 0
    .parameter "telephony"
    .parameter "connectivity"
    .parameter "file"

    .prologue
    .line 26
    invoke-direct {p0, p1, p2, p3}, Lcom/netease/netstat/statistics/BaseTest;-><init>(Landroid/telephony/TelephonyManager;Landroid/net/ConnectivityManager;Lcom/netease/netstat/utils/FileService;)V

    .line 28
    return-void
.end method


# virtual methods
.method public getlocalip()V
    .locals 5

    .prologue
    .line 31
    const/4 v2, 0x0

    .line 32
    .local v2, tcpSocket:Ljava/net/Socket;
    const/4 v0, 0x0

    .line 36
    .local v0, remoteAddr:Ljava/net/SocketAddress;
    sget-boolean v3, Lcom/netease/netstat/utils/Contanst;->airline:Z

    if-nez v3, :cond_1

    sget-boolean v3, Lcom/netease/netstat/utils/Contanst;->connectivity:Z

    if-eqz v3, :cond_1

    .line 37
    new-instance v2, Ljava/net/Socket;

    .end local v2           #tcpSocket:Ljava/net/Socket;
    invoke-direct {v2}, Ljava/net/Socket;-><init>()V

    .line 38
    .restart local v2       #tcpSocket:Ljava/net/Socket;
    if-eqz v2, :cond_1

    .line 41
    :try_start_0
    new-instance v1, Ljava/net/InetSocketAddress;

    const-string v3, "www.163.com"

    const/16 v4, 0x50

    invoke-direct {v1, v3, v4}, Ljava/net/InetSocketAddress;-><init>(Ljava/lang/String;I)V
    :try_end_0
    .catch Ljava/net/UnknownHostException; {:try_start_0 .. :try_end_0} :catch_2
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 42
    .end local v0           #remoteAddr:Ljava/net/SocketAddress;
    .local v1, remoteAddr:Ljava/net/SocketAddress;
    const/16 v3, 0x1f40

    :try_start_1
    invoke-virtual {v2, v1, v3}, Ljava/net/Socket;->connect(Ljava/net/SocketAddress;I)V

    .line 44
    if-eqz v2, :cond_0

    invoke-virtual {v2}, Ljava/net/Socket;->getLocalAddress()Ljava/net/InetAddress;

    move-result-object v3

    if-eqz v3, :cond_0

    .line 45
    invoke-virtual {v2}, Ljava/net/Socket;->getLocalAddress()Ljava/net/InetAddress;

    move-result-object v3

    .line 46
    invoke-virtual {v3}, Ljava/net/InetAddress;->getHostAddress()Ljava/lang/String;

    move-result-object v3

    .line 45
    invoke-static {v3}, Lcom/netease/netstat/utils/Contanst;->setLocalip(Ljava/lang/String;)V

    .line 48
    :cond_0
    invoke-virtual {v2}, Ljava/net/Socket;->close()V
    :try_end_1
    .catch Ljava/net/UnknownHostException; {:try_start_1 .. :try_end_1} :catch_3
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    move-object v0, v1

    .line 56
    .end local v1           #remoteAddr:Ljava/net/SocketAddress;
    .restart local v0       #remoteAddr:Ljava/net/SocketAddress;
    :cond_1
    :goto_0
    return-void

    .line 51
    :catch_0
    move-exception v3

    goto :goto_0

    .end local v0           #remoteAddr:Ljava/net/SocketAddress;
    .restart local v1       #remoteAddr:Ljava/net/SocketAddress;
    :catch_1
    move-exception v3

    move-object v0, v1

    .end local v1           #remoteAddr:Ljava/net/SocketAddress;
    .restart local v0       #remoteAddr:Ljava/net/SocketAddress;
    goto :goto_0

    .line 49
    :catch_2
    move-exception v3

    goto :goto_0

    .end local v0           #remoteAddr:Ljava/net/SocketAddress;
    .restart local v1       #remoteAddr:Ljava/net/SocketAddress;
    :catch_3
    move-exception v3

    move-object v0, v1

    .end local v1           #remoteAddr:Ljava/net/SocketAddress;
    .restart local v0       #remoteAddr:Ljava/net/SocketAddress;
    goto :goto_0
.end method
